using octalforty.Brushie.Web.XmlRpc;

namespace octalforty.Syndication.Blogging.MetaWeblog
{
    /// <summary>
    /// Defines a contract of the MetaWeblog XML-RPC service.
    /// </summary>
    public interface IMetaWeblogService : IXmlRpcService
    {
        /// <summary>
        /// Returns a collection of blogs <paramref name="login"/> can post to.
        /// </summary>
        /// <param name="applicationKey"></param>
        /// <param name="login"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        [XmlRpcServiceMethod("blogger.getUsersBlogs", "Returns information on all the blogs a given user is a member of.")]
        Blog[] GetUserBlogs(string applicationKey, string login, string password);

        /// <summary>
        /// Returns a collection of blog post categories.
        /// </summary>
        /// <param name="blogID"></param>
        /// <param name="login"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        [XmlRpcServiceMethod("metaWeblog.getCategories")]
        BlogPostCategory[] GetBlogPostCategories(string blogID, string login, string password);

        /// <summary>
        /// Returns a collection of <paramref name="numberOfPosts"/> recent <see cref="BlogPost"/> objects
        /// for a blog <paramref name="blogID"/>.
        /// </summary>
        /// <param name="blogID"></param>
        /// <param name="login"></param>
        /// <param name="password"></param>
        /// <param name="numberOfPosts"></param>
        /// <returns></returns>
        [XmlRpcServiceMethod("metaWeblog.getRecentPosts")]
        BlogPost[] GetRecentBlogPosts(string blogID, string login, string password, int numberOfPosts);

        /// <summary>
        /// Publishes <paramref name="blogPost"/> to blog <paramref name="blogID"/>.
        /// </summary>
        /// <param name="blogID"></param>
        /// <param name="login"></param>
        /// <param name="password"></param>
        /// <param name="blogPost"></param>
        /// <param name="publish"></param>
        /// <returns></returns>
        [XmlRpcServiceMethod("metaWeblog.newPost")]
        string NewBlogPost(string blogID, string login, string password, BlogPost blogPost, bool publish);

        /// <summary>
        /// Edits <paramref name="blogPost"/> in blog <paramref name="blogPostID"/>.
        /// </summary>
        /// <param name="blogPostID"></param>
        /// <param name="login"></param>
        /// <param name="password"></param>
        /// <param name="blogPost"></param>
        /// <param name="publish"></param>
        /// <returns></returns>
        [XmlRpcServiceMethod("metaWeblog.editPost")]
        bool EditBlogPost(string blogPostID, string login, string password, BlogPost blogPost, bool publish);

        /// <summary>
        /// Returns a <see cref="BlogPost"/> with a given identifier.
        /// </summary>
        /// <param name="blogPostID"></param>
        /// <param name="login"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        [XmlRpcServiceMethod("metaWeblog.getPost")]
        BlogPost GetBlogPost(string blogPostID, string login, string password);

        /// <summary>
        /// Adds a new media object <paramref name="mediaObject"/> to the blog <paramref name="blogID"/>.
        /// </summary>
        /// <param name="blogID"></param>
        /// <param name="login"></param>
        /// <param name="password"></param>
        /// <param name="mediaObject"></param>
        /// <returns></returns>
        [XmlRpcServiceMethod("metaWeblog.newMediaObject")]
        MediaObjectInfo NewMediaObject(string blogID, string login, string password, MediaObject mediaObject);
    }
}
